package com.cs.study.homework._0221;

public class Demo3 {
    public static void main(String[] args) {
        Son s = new Son();
        System.out.println(s.num);
        Father fs = new Son();
        System.out.println(fs.num);
        // Father f = new Father();
        Son s2 = new Son(30);
        System.out.println(s2.num);

        Father fs2 = new Son(30);
        System.out.println(fs2.num);
    }
}

class Father {
    int num = 10;

    public int getNum() {
        return num;
    }

    public Father() {
        System.out.println(getNum());
    }
}

class Son extends Father {
    int num = 20;

    @Override
    public int getNum() {
        return num;
    }

    public Son() {
        // super();
    }

    public Son(int num) {
        this.num = num;
    }
}

